
package com.core.service;

import com.core.bean.*;
import com.core.utils.UUIDTool;

import java.util.Date;

public class LoginService {

    private String smsCode;

    private String checkCode;

    private Online online;

    public boolean checkIdentity(String id)throws Exception{
        return true;
    }

    public String doLogin(User user,String pwd,String ip,String devInfo,String os)throws Exception{
        Password password = new Password();
        password.setUser(user);
        password.setPwd(pwd);
        if(!password.isActive())
            throw new Exception();

        online = new MutilpleOnline();
        online.setId(UUIDTool.getUUID());
        online.setDevInfo(devInfo);
        online.setOs(os);
        online.setIp(ip);
        online.setLoginTime(new Date());
        online.setUser(user);
        online.setToKen(new UUIDToken().createToken());
        online.login();
        return online.getToKen();
    }

    public void checkCode()throws Exception{

    }

    public void checkSMS(String submitCode)throws Exception{

    }

    public String getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(String smsCode) {
        this.smsCode = smsCode;
    }

    public String getCheckCode() {
        return checkCode;
    }

    public void setCheckCode(String checkCode) {
        this.checkCode = checkCode;
    }

    public Online getOnline() {
        return online;
    }

    public void setOnline(Online online) {
        this.online = online;
    }
}

